package com.zzyl.member.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.member.mapper.MemberOrderProjectMapper;
import com.zzyl.member.service.IMemberOrderProjectService;
import com.zzyl.serve.domain.NursingProject;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public  class MemberOrderProjectServiceImpl extends ServiceImpl<MemberOrderProjectMapper, NursingProject> implements IMemberOrderProjectService {


    @Override
    public TableDataInfo<NursingProject> pageList(String name,Integer status) {
        List<NursingProject> list = this.list(Wrappers.<NursingProject>lambdaQuery()
                .like(name != null, NursingProject::getName, name)
                .eq(status != null, NursingProject::getStatus, status)
                .orderByDesc(NursingProject::getUpdateTime)
        );
        TableDataInfo<NursingProject> res = new TableDataInfo<>();
        res.setCode(200);
        res.setRows(list);
        res.setTotal(list.size());
        res.setMsg("查询成功");
        return res;
    }

    @Override
    public NursingProject getByID(Integer id) {
        return this.getById(id);
    }
}
